<!-- Generated automatically from an XML file of the same name.
     Copyright: Stephen J. Sangwine and Nicolas Le Bihan, 2008-2010.
--><html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <title>unit :: Functions (Quaternion Toolbox Function Reference)
</title><link rel="stylesheet" href="qtfmstyle.css" type="text/css"></head><body><h1>Quaternion Function Reference</h1><h2>unit</h2>
<p>Unit quaternion</p>
<h2>Syntax</h2><p><tt>Y = unit(X)</tt></p>
<h2>Description</h2>
<p>
<tt>unit(X)</tt> divides each element of its argument by its modulus to
return quaternions with unit modulus.
</p>

<h2>Examples</h2>
<pre>
&gt;&gt; unit(quaternion(1,2,3,4))
 
ans = 0.1826 + 0.3651 * I + 0.5477 * J + 0.7303 * K
</pre>
A unit pure quaternion is a root of -1, whether the quaternion is real or
complex:
<pre>
&gt;&gt; q = unit(randv)
 
q = 0.6552 * I - 0.2884 * J + 0.6983 * K
 
&gt;&gt; q.^2
 
ans = -1 + 0 * I + 0 * J + 0 * K

&gt;&gt; q = unit(complex(randv, randv))
 
q = (0.9195+0.0758i) * I + (0.00383+0.2233i) * J + (0.4813-0.1466i) * K
 
&gt;&gt; q.^2
 
ans = (-1+8.327e-17i) + (0) * I + (0) * J + (0) * K
</pre>

<h2>See Also</h2>QTFM function: <a href="sign.html">sign</a><br>
<h4>&copy; 2008-2010 Stephen J. Sangwine and Nicolas Le Bihan</h4><p><a href="license.html">License terms.</a></p></body></html>